﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace BesAsm.Emgaats.Maintenance
{
    public class UILinkToolSettingsButton : ESRI.ArcGIS.Desktop.AddIns.Button
    {
        private ApplicationWindow _appWindow;

        public UILinkToolSettingsButton()
        {
            _appWindow = new ApplicationWindow(ArcMap.Application.hWnd);
        }

        protected override void OnClick()
        {
            try
            {
                ArcMap.Application.CurrentTool = null;

                LinkToolSettingsForm form = new LinkToolSettingsForm();
                form.Show(_appWindow);
            }
            catch(Exception ex)
            {
                MessageBox.Show(_appWindow, ex.GetType().FullName + ": " + ex.Message, this.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

        protected override void OnUpdate()
        {
            Enabled = ArcMap.Application != null;
        }
    }

}
